package com.camunda.workflow.common.base;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mybatisflex.annotation.Column;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Data
public abstract class BaseEntity extends BaseReq implements Serializable {
    @JSONField(serialize = false)
    @Column(ignore = true)
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "状态 0-正常 ;1-禁用")
    private Integer status;
    @Column(isLogicDelete = true)
    @ApiModelProperty(value = "逻辑删除标记 0-未删除 ； 1-已删除")
    @JsonIgnore
    private Integer deleted;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "创建者")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long creator;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(onInsertValue = "now()")
    private LocalDateTime createdTime;

    @ApiModelProperty(value = "修改者")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long editor;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(onUpdateValue = "now()")
    private LocalDateTime editedTime;


}
